package btree;

import btree.base.TreeNode;

public class Solution_101 {
    public boolean isSymmetric_dfs(TreeNode root) {
        return root == null || check(root.left, root.right);
    }

    private boolean check(TreeNode L, TreeNode R) {
        if (L == null && R == null) return true;
        if (L == null || R == null || L.val != R.val) return false;
        return check(L.left, R.right) && check(L.right, R.left);
    }
}
